package ysc.cqnu.operdb.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import ysc.cqnu.operdb.entity.ResultData;
import ysc.cqnu.operdb.serviceImpl.UploadImgServiceImpl;

@CrossOrigin
@Controller
@ResponseBody
public class UploadImgController {
    @Autowired
    private ResultData resultData;
    @Autowired
    private UploadImgServiceImpl uploadImgService;
    @RequestMapping(value = "/upload" ,method = RequestMethod.POST)
    public ResultData upload(@RequestParam(value = "name",defaultValue = "moren") String name,@RequestParam(value = "adImage") MultipartFile adImage,
                             @RequestParam(value = "age") String age,@RequestParam(value = "sex") String sex,
                             @RequestParam(value = "emile") String emile) {
        System.out.println("换头像前端已连接");
        resultData = uploadImgService.uploadImgService(name,adImage,age,sex,emile);
        return resultData;
    }

}
